﻿using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ReaWTM.LayuiHelper
{


}
namespace ReaWTM.LayuiHelper
{

	[HtmlTargetElement("wt:report-header", TagStructure = TagStructure.NormalOrSelfClosing)]
	public class ReportHeaderTagHelper : BaseTag
	{
		public ReportHeaderTagHelper()
		{
			FontSize = FontSizeEnum.Mini;
		}
		public int PaddingTop { get; set; }
		public string Title { get; set; }
		public string LeftText { get; set; }
		public string RightText { get; set; }
		public override void Process(TagHelperContext context, TagHelperOutput output)
		{
			output.TagName = "div";
			output.TagMode = TagMode.StartTagAndEndTag;
			output.Attributes.Add("style", $"padding-top:{PaddingTop}px;");
			StringBuilder build = new StringBuilder();
			build.Append($@"
<div style='text-align:center;'>
    <h1>{Title}</h1>
</div>
<div class='{GetBgColorClass()} {GetFontColorClass()} {GetFontSizeClass()}'>
    <div style='float:left;'>{LeftText}</div>
    <div style='float:right;'>{RightText}</div>
</div>
<hr class='layui-border-blue'/>
");
			output.Content.SetHtmlContent(build.ToString());
			base.Process(context, output);
		}
	}
}
